package com.atguigu.gmall.pay.controller;

import com.alipay.api.AlipayApiException;
import com.atguigu.gmall.common.util.UserAuthUtil;
import com.atguigu.gmall.pay.service.PayService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author lhh
 * @ClassName PayController
 * @date 2022 2022/12/25
 */

@RestController
@RequestMapping("/api/payment")
public class PayController {

    @Resource
    PayService payService;

    @GetMapping("/alipay/submit/{orderId}")
    public String alipay(@PathVariable Long orderId) throws AlipayApiException {
        Long userId = UserAuthUtil.getUserId();
        String page = payService.generatePayPage(orderId,userId);
        return page;
    }
}
